﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using MDM.GUI.MDM.Business;
using MDM.GUI.MDM.DataObjects;


namespace MDM.GUI
{
    public partial class InstallForm : DevExpress.XtraEditors.XtraForm
    {

        // int d;

        int c;
        //truyen vao so file da duoc gan ben MainForm
        public InstallForm(int inumberfile)
        {
            InitializeComponent();
            c = inumberfile;
            progressBarControl1.Properties.Maximum = c;

            /*
            Timer time = new Timer();
            time.Interval = 10;
            time.Start();
            time.Tick += new EventHandler(InstallForm_Load);
             */

        }
        private void btnStop_Click(object sender, EventArgs e)
        {
            this.Close();
        }
        private void InstallForm_Load(object sender, EventArgs e)
        {
            //b1: 
            bool blCheck = ModuleManager.ValidateModule(Common.sModuleName);
            if (blCheck == true)
            {

            }
            else
            {

            }

            //
                //
            ModuleManager.DoProcessHandler += new DoProcess(ModuleManager_DoProcessHandler);

        }

        void ModuleManager_DoProcessHandler(string fileName)
        {
           
            //throw new NotImplementedException();
            listBoxControl1.Items.Add(fileName);

            if (c >= 0)
            {
                c--;
                progressBarControl1.Position += 1;
                if (progressBarControl1.Position == progressBarControl1.Properties.Maximum)
                {
                    btnStop.Enabled = true;
                }
            }
        }

        public void OpenDialog(String sModulePath)
        {
          //  super(OpenDialog());
        }

        private void listBoxControl1_SelectedIndexChanged(object sender, EventArgs e)
        {
            //viet event cho 1 class:
            //neu ktra thanh cong da copy, cap nhat progress bar
        }

        private void progressBarControl1_EditValueChanged(object sender, EventArgs e)
        {

        }

      
    }
}